import request from "@/plugins/request";

var pre = "/inteCater/foodBeverages/myOrder";

if (process.env.NODE_ENV !== "development") {
  pre = "/api/sa/smar-catering" + pre;
}

// 获取当前用户订单信息
export function getOrderInfoByPageForUser(data) {
  return request({
    url: `${pre}/getOrderInfoByPageForUser`,
    method: "post",
    data,
  });
}

// 取消订单
export function updateCancelOrder(data) {
  return request({
    url: `${pre}/updCancelOrder`,
    method: "post",
    data,
  });
}

// 收货
export function updateReceiptOrder(orderId) {
  return request({
    url: `${pre}/updReceiptOrder`,
    method: "post",
    data: {
      orderId,
      orderStatus: "3",
    },
  });
}

// 设置评价
export function setOrderComment(data) {
  return request({
    url: `${pre}/setOrderComment`,
    method: "post",
    data,
  });
}

// 申请退款
export function updRefund(data) {
  return request({
    url: `${pre}/updRefund`,
    method: "post",
    data,
  });
}

// 删除退款信息
export function delOrderBack(orderId) {
  return request({
    url: `${pre}/delOrderBack?orderId=${orderId}`,
    method: "get",
  });
}

// 查询退款信息
export function getRefundInfoByOrderId(orderId) {
  return request({
    url: `${pre}/getRefundInfoByOrderId?orderId=${orderId}`,
    method: "get",
  });
}

